<template>
  <div class="boss">
    <head-page class="head-page" id="backstyle" title="新产品"></head-page>
    <Banner id="6" class="bannerId"></Banner>
    <div class="bottom fcc">
      <div class="area-center title-center">
        <div class="umit ">
          <div
            class="xiao m-t-07"
            v-for="(item, index) in list"
            :key="index"
            @click="productlist(item)"
          >
            <div class="left">
              <div
                class="yuan"
                :class="['zhong', item.producttypeId == ID ? 'backactive' : '']"
              ></div>
            </div>
            <div
              class="zhong title_word"
              :class="['zhong', item.producttypeId == ID ? 'active' : '']"
            >
              {{ item.producttypeName }}
            </div>
          </div>
        </div>
        <div class="shenghui ">
          <div class="title_word">请选择</div>
    
            
          </div>
          <!-- 定位的省份 -->
          <div class="text_top" id="tex" @click="provincial(ID, city, citysub, Title)">
            <div class="icon">
              <img src="../../../assets/black_star.png" alt="" />
            </div>
            <div class="text title_word">
              {{ city }}
            </div>
          </div>
          <!-- 全国各省和海外-->
          <div
            class="text_top"
            v-for="(item, index) in address"
            :key="index"
            @click="Productnationwide(item.text, ID, Headtitle, Title)"
          >
            <div class="icon">
              <img src="../../../assets/black_star.png" alt="" />
            </div>
            <div class="text title_word">
              {{ item.text }}
            </div>
          </div>
       
        <!-- 重要产品 -->
        <div
          class="text_top"
          v-for="(item, index) in text"
          :key="index"
          @click="Importantproducts(item, Title)"
        >
          <div class="icon">
            <img src="../../../assets/black_star.png" alt="" />
          </div>
          <div class="text title_word">
            {{ item.producttypeName }}
          </div>
        </div>
      </div>
    </div>
  </div>

</template>

<script>
import Banner from "@/components/Home/BannerView.vue";
import { productType } from "@/api/index";
export default {
  data() {
    return {
      list: [],
      ID: this.$route.query.id,
      Headtitle: "新产品",
      text: this.$route.query.i,
      Title: this.$route.query.title,
      city: sessionStorage.getItem("province") + "产品",
      citysub: sessionStorage.getItem("provincesub"),
      address: [{ text: "全国各省产品" }, { text: "海外产品" }],
    };
  },
  components: {
    Banner,
  },
  created() {
    //大项目列表
    productType({
      producttypeIdenti: "one",
    }).then((res) => {
      if (res.data.code == 200) {
        this.list = res.data.data;
      }
    }),
      productType({
        producttypeIdenti: "all",
      }).then((res) => {
        if (res.data.code == 200) {
          this.text = res.data.data;
        }
      });
  },
  methods: {
    //列表
    productlist(item) {
      this.ID = item.producttypeId;
      this.Title = item.producttypeName;
    },
    //定位的省份
    provincial(id, title, citysub, top_title) {
      this.$router.push({
        path: "/productlist",
        query: {
          id,
          title,
          citysub,
          top_title,
        },
      });
    },
    //全国各省和海外
    Productnationwide(title, id, Headtitle, top_title) {
      if (title == "全国各省产品") {
        this.$router.push({
          path: "/largenation",
          query: { title, id, Headtitle, top_title },
        });
      } else {
        this.$router.push({
          path: "/productlist",
          query: {
            title,
            citysub: title.slice(0, 2),
            id,
            top_title,
          },
        });
      }
    },
    //重要产品
    Importantproducts(item, top_title) {
      this.$router.push({
        path: "/productlist",
        query: {
          id: item.producttypeId,
          title: item.producttypeName,
          top_title,
        },
      });
    },
  },
};
</script>

<style scoped>
.boss {
  width: 100%;
  height: 5rem;
}
/* 底部区域 */
.bottom {
  width: 100%;
  min-height: 2rem;
}
/* 版心区域 */
.bottom .center {
  width: 98%;
  min-height: 100%;
}
.umit {
  width: 100%;
  min-height: 0.4rem;
}
.xiao {
  width: 100%;
  display: flex;
}
/* 左边区域 */
.xiao .left {
  width: 5%;
  height: 0.3rem;
  margin-right: 0.07rem;
}
.xiao .left .yuan {
  width: 0.18rem;
  height: 0.18rem;
  border-radius: 50%;
  background-color: black;
  margin-top: 0.06rem;
}
/* 中间区域 */
.zhong {
  height: 100%;
  line-height: 0.32rem;
  margin-left: 0.03rem;
}
.shenghui {
  display: flex;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.text_top {
  width: 100%;
  height: 0.3rem;
  display: flex;
  margin: .05rem 0;
}
#tex{
  margin-top: .1rem;
}
.text_top .icon {
  width: 10%;
}
.icon img {
  padding: 0.04rem 0 0 0.06rem;
  height: 0.2rem;
}

.text_top .text {
  width: 90%;
  line-height: 0.3rem;
}
</style>